package com.ygl.strategy.gateway.configuration;

import com.ygl.strategy.adapter.DefaultDiscoveryEnabledAdapter;
import com.ygl.strategy.adapter.DiscoveryEnabledAdapter;
import com.ygl.strategy.constant.StrategyConstant;
import com.ygl.strategy.gateway.filter.DefaultGatewayStrategyClearFilter;
import com.ygl.strategy.gateway.filter.DefaultGatewayStrategyRouteFilter;
import com.ygl.strategy.gateway.filter.GatewayStrategyClearFilter;
import com.ygl.strategy.gateway.filter.GatewayStrategyRouteFilter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.ribbon.RibbonClientConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * author: yanggld
 * date: 2019/12/21 21:57
 * version: 1.0
 * description: GatewayStrategyAutoConfiguration
 */
@Configuration
@AutoConfigureBefore(RibbonClientConfiguration.class)
public class GatewayStrategyAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public GatewayStrategyRouteFilter gatewayStrategyRouteFilter() {
        return new DefaultGatewayStrategyRouteFilter();
    }

    @Bean
    @ConditionalOnMissingBean
    public GatewayStrategyClearFilter gatewayStrategyClearFilter() {
        return new DefaultGatewayStrategyClearFilter();
    }

    @Bean
    @ConditionalOnMissingBean
    public DiscoveryEnabledAdapter discoveryEnabledAdapter() {
        return new DefaultDiscoveryEnabledAdapter();
    }
}
